﻿@using NetSurveillance.WebApp.Utilities
@model NetSurveillance.WebApp.DataServices.Models.MonitorSetting
@{
    ViewBag.Title = Resources.MenuResource.SystemSetting_FieldSetting;
    Layout = "~/Views/Shared/_SystemConfigLayout.cshtml";
    ViewBag.CurrentMiddleMenu = 2;
    ViewBag.CurrentMainMenu = 5;
    string displayFieldSelectStr = ViewData["displayFields"] as string;
    var displayFields = SupportUtility.GetDisplayField();
    displayFieldSelectStr = string.IsNullOrWhiteSpace(displayFieldSelectStr) ?
                                string.Join(",", displayFields.Select(p => p.PropertyName)) : displayFieldSelectStr;
}

<h3 id="contentHeader">
    @ViewBag.Title
</h3>
@using (Html.BeginForm())
{
    @Html.ValidationSummary()
    <div id="monitorContent" class="config_content0">
        <fieldset id="fieldSetting">
            <legend>数据显示字段</legend>
            <div>
                <ul>
                    @foreach (var fieldKeyPair in displayFields)
                    {
                        <li>
                            <label>
                                @Html.CheckBox("displayFields", fieldKeyPair.PropertyName,
                                               !string.IsNullOrWhiteSpace(displayFieldSelectStr) && 
                                               displayFieldSelectStr.Contains(fieldKeyPair.PropertyName))
                                @fieldKeyPair.DisplayText
                            </label>
                        </li>
                    }
                </ul>
            </div>
        </fieldset>
        <fieldset id="pageSizeSetting">
            <legend>数据查询每页默认记录数</legend>
            <div>
                <label>记录数</label>
                @Html.TextBoxFor(m => m.DefaultPageSize)
                条
            </div>
        </fieldset>
        <fieldset id="otherSetting">
            <legend>是否显示无Title记录</legend>
            <div>
                <label>@Html.RadioButtonFor(m => m.IsShowTitleRecord, true) 是</label>
                <label>@Html.RadioButtonFor(m => m.IsShowTitleRecord, false) 否</label>
            </div>
        </fieldset>
        <div class="buttonsContain">
            @Html.Hidden("Id")
            <ul class="config_bottom_btndivs">
                <li>
                    <input type="submit" id="btnSaveQuery" value="@Resources.Resource.Button_Apply"/>
                </li>
                <li>
                    <input type="reset" id="btnResetChanges" value="@Resources.Resource.Button_ResetChanges"/>
                </li>
            </ul>
        </div>
    </div>
}
@section css{
    <style type="text/css">
        #contentHeader
        {
            text-align: center;
            margin: 5px 0 10px 0;
            font-size: 1.5em;
        }

        #fieldSetting ul li
        {
            display: inline-block;
            *display: inline;
            zoom: 1;
            width: 100px;
        }

        #fieldSetting div, #pageSizeSetting div, #otherSetting div
        {
            width: 100%;
            height: auto;
            overflow: hidden;
            background: #ebebeb;
            padding: 40px 0 40px 0;
            margin: 20px 0 35px 0;
        }
    </style>
}